import React, { forwardRef } from 'react';
import { Select } from 'antd';

const { Option } = Select;

const DictSelect = forwardRef(({
    value,
    disabled,
    onChange,
    dictList = {},
    dictName,
    ...rest
}) => <Select
    value={value}
    onChange={onChange}
    disabled={disabled}
    placeholder="请选择"
    optionFilterProp = "children"
    {...rest}
>
    {
        (dictList[dictName] || []).map(item => <Option value={item.key} key={item.key}>{item.value}</Option>)
    }
</Select>);
export default DictSelect
